#pragma once
#include <vector>
#include "dataTypes.h"
using namespace std;

struct KeyFrame
{
	float angle;
	float length;

	int duration;

	KeyFrame* nextFrame;

	KeyFrame()
	{
		Build(0,0,0);
	}

	KeyFrame(float aAngle, float aLength, int aDuration)
	{
		Build(aAngle, aLength, aDuration);
	}

	KeyFrame(const KeyFrame& k)
	{
		Build(k.angle,k.length,k.duration);
	}

	void Build(float aAngle, float aLength, int aDuration)
	{
		angle = aAngle;
		length = aLength;
		duration = aDuration;
		nextFrame = NULL;
	}

	void operator()(double aAngle, double aLength, int aDuration)
	{
		Build((float)aAngle, (float)aLength, aDuration);
	}
};

class AnimationFrame
{
	public:
		AnimationFrame(){};
		AnimationFrame(int aAnimation, int aFrame, int aSpeed);

		int GetKeyFramesCount() {return keyFrames.size();};
		KeyFrame* GetKeyFrame(int aI);

	private:
		vector<KeyFrame> keyFrames;
};

class Animation
{
	public:
		Animation();
		void Build(int aSpeed);
		AnimationFrame* GetFrame(int aAnimation);

		float GetSpeed() {return (float)speed;};

	private:
		AnimationFrame defaultPose;
		vector<AnimationFrame> walkRight;
		vector<AnimationFrame> walkLeft;
		vector<AnimationFrame> walkUp;
		vector<AnimationFrame> walkDown;
		int speed;
};